<template>
	<view>
		<private_tip :privateShow="privateb"></private_tip>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				privateb: false,
			}
		},
		onLoad(options) {
			let _this = this;
			if(app.globalData.wxprivate==-1){
				app.watchG('wxprivate',function(value){
					_this.wxprivate=value;
					if(value){ //弹出弹窗
						_this.privateb=true;
					}else{
						_this.onload(options);
					}
				})
			}else{
				if (app.globalData.wxprivate) { //弹出弹窗
					_this.privateb = true;
				} else {
					_this.onload(options);
				}
			}
		},
		methods: {
			onload(options) {
				let latitude = Number(options.latitude),
					longitude = Number(options.longitude),
					scale = Number(options.scale),
					name = decodeURIComponent(options.name),
					address = decodeURIComponent(options.address);
				uni.openLocation({
					latitude,
					longitude,
					scale: scale ? scale : 15,
					name,
					address,
					success() {
						console.log("打开地图成功");
						uni.navigateBack({
							delta: 1
						})
					},
					fail(err) {
						console.log("打开地图失败:", err.errMsg);
						uni.navigateBack({
							delta: 1
						})
					},
				});
			},
		}
	}
</script>

<style>

</style>